var knex = require('../dbhelper').instance();
var Promise = require('bluebird');
module.exports = {
    check: function (md5path) {
        return new Promise(function (resolve, reject) {
            knex('fileresource').where('md5path',md5path).select('resourceid','pid').then(function (data) {
                resolve(data);
            }).catch(function (error) {
                console.error(error);
                reject(error);
            });
        });
    },
    getdirectory:function () {
        return new Promise(function (resolve, reject) {
            knex('directoryresource').orderBy('createat').select('*').then(function (data) {
                resolve(data);
            }).catch(function (error) {
                console.error(error);
                reject(error);
            });
        });
    }
}